package io.renren.modules.store.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.store.dao.TStoreFoodTypeDao;
import io.renren.modules.store.entity.TStoreFoodTypeEntity;
import io.renren.modules.store.service.TStoreFoodTypeService;


@Service("tStoreFoodTypeService")
public class TStoreFoodTypeServiceImpl extends ServiceImpl<TStoreFoodTypeDao, TStoreFoodTypeEntity> implements TStoreFoodTypeService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TStoreFoodTypeEntity> page = this.page(
                new Query<TStoreFoodTypeEntity>().getPage(params),
                new QueryWrapper<TStoreFoodTypeEntity>()
                .eq(params.get("status") != null , "status",params.get("status"))
                        .eq(!params.get("sellerId").equals(""),"seller_id",params.get("sellerId"))
                .like(params.get("useRange")!=null,"use_range",params.get("useRange"))
                .eq(!params.get("key").equals(""),"classification_no",params.get("key"))
                .or()
                        .eq(!params.get("key").equals(""),"classification_name",params.get("key"))
        );

        return new PageUtils(page);
    }

}